#include "common.h"
int main()
{
    int wfd = open(NAMED_PIPE, O_WRONLY); // 用户端以写的方式打开
    if (wfd == -1)                        // 打开失败
        exit(1);
    char buffer[1024];
    while (true)
    {
        std::cout << "you can say:";
        fgets(buffer, sizeof(buffer), stdin); // fgets剩一个空间会被系统填充'\0',不用-1
        ssize_t s = write(wfd, buffer, strlen(buffer));
        assert(s == strlen(buffer));
        (void)s;
    }
    close(wfd);
    return 0;
}